package com.mycompany.chatapp;



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;

public class App 
{
    public static void main( String[] args ) throws IOException, XMPPException
    {
       
        //BufferedReader userName = new BufferedReader(new InputStreamReader(System.in));       
        //BufferedReader password = new BufferedReader(new InputStreamReader(System.in));
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String msg;
        
        String user="usuariopruebagrupoc@gmail.com";
        System.out.println("Enter your user name (full email address): "+user);
        //String user=userName.readLine();
        
        System.out.println("Enter your password: "+"********");
        String pass="1234grupoc";
        //String pass=password.readLine();
        
        //Create the ImpInstantMessage object
        ImpInstantMessage.getIntanceMessage();
        
        //Allows see a debug of Smack library
        XMPPConnection.DEBUG_ENABLED = false;
        
        //Login of the user
        ImpInstantMessage.getIntanceMessage().login(user,pass);
       ImpInstantMessage.getIntanceMessage().addHash();
        //Show a list of contacts
        System.out.println("**************CONTACT LIST***********************");
        ImpInstantMessage.getIntanceMessage().displayContactList();
        System.out.println("*************************************************");
        
        System.out.println("Enter a contact to talk (Write full email address): ");
        //String talkTo = br.readLine();
        String talkTo = null;

        System.out.println("*************************************************");
        System.out.println("All messages will be sent to " + talkTo);
        System.out.println("Enter your message in the console:");
        System.out.println("-----\n");

        while (!(msg = br.readLine()).equals("bye")) {
           ImpInstantMessage.getIntanceMessage().sendMessageSearchProfile(msg);
        }

        ImpInstantMessage.getIntanceMessage().logout();
        System.exit(0);
     }
}
